#include <opencv2\opencv.hpp>
using namespace cv;
int main()
{
	Mat img = imread("coins.png",0);
	Mat thresh1, thresh2;
	threshold(img, thresh1, 127, 255, THRESH_BINARY);
	threshold(img, thresh2, 0, 255, THRESH_BINARY + THRESH_OTSU);

	imshow("Original Image", img);
	imshow("BINARY", thresh1);
	imshow("OTSU", thresh2);
	waitKey(0);
	return 0;
}